no.feide.mellon.filter
Class AuthenticationFilter

java.lang.Object
  extended by no.feide.mellon.filter.AuthenticationFilter
All Implemented Interfaces:
javax.servlet.Filter

public class AuthenticationFilter
extends java.lang.Object
implements javax.servlet.Filter

The less-than-elegant use of system properties to store filter configuration has been preserved to provide maximum backwards compatibility with the Mellon1 version of this filter.


Field Summary
private  no.feide.moria.log.MessageLogger log
          Used for logging.
static java.lang.String[] OPTIONAL_PROPERTIES
          Optional configuration properties.
static java.lang.String PROPERTY_FILE
          The filename of the filter configuration file.
static java.lang.String[] REQUIRED_PROPERTIES
          Required configuration properties.
 
Constructor Summary
AuthenticationFilter()
           
 
Method Summary
 void destroy()
          Does nothing.
 void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)
          Perform authentication.
 void init(javax.servlet.FilterConfig config)
          Initialize configuration for this filter.
private  void setProperty(java.lang.String property, javax.servlet.FilterConfig filterConfig, java.util.Properties propertyFile)
          Utility method used to set each configuration property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private no.feide.moria.log.MessageLogger log
Used for logging.


REQUIRED_PROPERTIES

public static final java.lang.String[] REQUIRED_PROPERTIES
Required configuration properties.

Current values are


OPTIONAL_PROPERTIES

public static final java.lang.String[] OPTIONAL_PROPERTIES
Optional configuration properties.

Current values are


PROPERTY_FILE

public static final java.lang.String PROPERTY_FILE
The filename of the filter configuration file.

Current value is "/mellon.properties".

See Also:
Constant Field Values
Constructor Detail

AuthenticationFilter

public AuthenticationFilter()
Method Detail

init

public void init(javax.servlet.FilterConfig config)
          throws javax.servlet.ServletException
Initialize configuration for this filter.

Specified by:
init in interface javax.servlet.Filter
Parameters:
config - The filter configuration.
Throws:
javax.servlet.ServletException - If unable to set the filter's Mellon2 configuration.

setProperty

private void setProperty(java.lang.String property,
                         javax.servlet.FilterConfig filterConfig,
                         java.util.Properties propertyFile)
                  throws javax.servlet.ServletException
Utility method used to set each configuration property. System properties already set take precedence over properties set in the filter's configuration, which again take precedence over properties set in the configuration file PROPERTY_FILE.

Parameters:
property - The property to set. string.
filterConfig - The filter's configuration.
propertyFile - Properties read from the file PROPERTY_FILE.
Throws:
javax.servlet.ServletException - If unable to set property based on these three sources.

destroy

public void destroy()
Does nothing.

Specified by:
destroy in interface javax.servlet.Filter

doFilter

public void doFilter(javax.servlet.ServletRequest request,
                     javax.servlet.ServletResponse response,
                     javax.servlet.FilterChain chain)
              throws java.io.IOException,
                     javax.servlet.ServletException
Perform authentication. If a requests already belongs to a session and the session contains user data, the user alrady has been authenticated and are let through. If no user data is present, the user is redirected to the Moria2 instance for login. After the user returns following a successful authentication, user data will be fetched from Moria2 and stored in the HttpSession. Servlets, or other filters, may then use these data for user authorization.

Specified by:
doFilter in interface javax.servlet.Filter
Parameters:
request - The request.
response - The response.
chain - The filter chain.
Throws:
java.io.IOException
javax.servlet.ServletException - If a problem should occur using the client-side API.


Copyright © 2001-2006 UNINETT FAS. All Rights Reserved.